This example deletes the value for "Name", from the current user's registry, under the key "Names".
Dim key As Microsoft.Win32.RegistryKey
key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Names", True)
key.DeleteValue("Name")
Replace the "Names" parameter with the name of a key that exists directly under the HKEY_CURRENT_USER node of the registry.
Replace the "Name" parameter with the name of a value that exists directly under the "Names" node.
Changing the True parameter to False makes the key read-only,
and you will not be able to delete it using the key
variable.
When reading the registry from a Web application, the current user depends on the authentication and impersonation implemented in the Web application. To determine the current user in a Web application, see Code: Getting the User or Account Identity (Visual Basic).
The following conditions may cause an exception:
Code:
Creating a Key In the Registry (Visual Basic) | Code:
Reading Data from the Registry (Visual Basic) |